package app.server.project.main.service.dto.race;

import app.server.project.main.service.db.entity.cfg.RaceCfgEntity;
import app.server.project.main.service.db.entity.user.UserRaceEntity;
import lombok.Data;

@Data
public class RaceInfoDto {


    private UserRaceEntity userRace;
    private RaceCfgEntity cfg;
    private String hotVal;

    public static RaceInfoDto of(RaceCfgEntity cfgEntity, UserRaceEntity userRaceEntity, long hotVal) {
        RaceInfoDto dto = new RaceInfoDto();
        dto.setCfg(cfgEntity);
        dto.setHotVal(String.valueOf(hotVal));
        dto.setUserRace(userRaceEntity);
        dto.getUserRace().setWeekFreeNum(userRaceEntity.getActivityFreeNumByCfg(cfgEntity));
        return dto;
    }

    public static RaceInfoDto ofAiCoin(RaceCfgEntity cfgEntity, long num, long hotVal, long freeNum) {
        RaceInfoDto dto = new RaceInfoDto();
        dto.setCfg(cfgEntity);
        dto.setHotVal(String.valueOf(hotVal));
        UserRaceEntity userRaceEntity = new UserRaceEntity();
        userRaceEntity.setVal(num);
        userRaceEntity.setWeekFreeNum(freeNum);
        dto.setUserRace(userRaceEntity);
        return dto;
    }
}
